home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 774 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  2.0 KB

  1. Path: EU.net!sun4nl!xs4all!usenet
  2. From: martijnl@xs4all.nl (Martijn Lievaart)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Need help with buttons!
  5. Date: 7 Jan 1996 00:57:58 GMT
  6. Organization: XS4ALL, networking for the masses
  7. Message-ID: <4cn5qm$he7@news.xs4all.nl>
  8. References: <4ckad5$13pg@news.gate.net>
  9. NNTP-Posting-Host: mas01-09.dial.xs4all.nl
  10. X-Newsreader: WinVN 0.99.6
  11.  
  12. In article <4ckad5$13pg@news.gate.net>, debmcd@isysfla.com says...
  13. >
  14. >I am writing a Windows multimedia program in Visual C++...
  15. >
  16. >In this program, there is a button that when pressed, will execute functions 
  17. that take some time to complete.  While this 
  18. >execution is occuring, I don't want the user to be able to press the button 
  19. again.  Does any one know of a way to lock out all 
  20. >mouse clicks until certain commands are finished executing????
  21. >
  22. >(I have tried changing to the WAIT icon and disabling, or graying, the button 
  23. as well as the entire window...this does not help.  
  24. >When this was done, all mouse click-messages are sent to the queue and still 
  25. processed when the previous execution is 
  26. >complete.)  For example, if the button were to play an audio clip when 
  27. pressed, and the user clicks the mouse over the button 
  28. >again, before the audio clip is finished, the audio clip would play 
  29. again--and I don't want this!
  30. >
  31. >Please help!!
  32. >
  33. >Thank you!
  34. >
  35. >D. McDonough
  36.  
  37. I once saw a nice trick for this. I would have to look it up to see how it was 
  38. done exactly but I'll give you the gist.When you want to 'eat the mouse input' 
  39. create a transparent childwindow over your window. (You may want to Z-move the 
  40. cancelbutton to be above this window so that stays responsive). I think all 
  41. your controls will have to have the style parent-DC, buildin controls are. Now 
  42. all mouse input goes to this window and never go to the button. Mail me if you 
  43. need more help with this.
  44.  
  45. As an alternative, eat all messages when you re-enable the button.
  46.  
  47. BTW, your article contained very long lines. Kinda makes it hard to read. 
  48. Please limit to 80 chars.
  49.  
  50. Hope this helps,
  51. Martijn
  52.  
  53.